//
//  SpecialTableViewCell.m
//  味·道
//
//  Created by lizi on 15/6/30.
//  Copyright (c) 2015年 WMR. All rights reserved.
//

#import "SpecialTableViewCell.h"
#import "MaocHeader.h"
#import <UIImageView+WebCache.h>

@implementation SpecialTableViewCell
- (void)dealloc
{
    [_label release];
    [_picView release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self p_setupSubviews];
    }
    return self;
}
//布局子视图
- (void)p_setupSubviews{
    _picView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH-20, 130) ];
    [self.contentView addSubview:_picView];
    _labelView = [[UIView alloc] initWithFrame:CGRectMake(0, 110, SCREEN_WIDTH-20, 20)];
    _labelView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
    [_picView addSubview:_labelView];
    _label = [[UILabel alloc] initWithFrame:CGRectMake(10, 105, (self.frame.size.width-20), 30)];
    _label.backgroundColor = [UIColor clearColor];
    _label.textColor = [UIColor whiteColor];
    [self.picView addSubview:_label];
    [_picView release];
    [_labelView release];
    [_label release];
}
-(void)setModel:(SpecialModel *)model{
    if (_model!=model) {
        [_model release];
        _model = [model retain];
    }
     _label.text = model.title;
    [_picView sd_setImageWithURL:[NSURL URLWithString:model.thumb] placeholderImage:[UIImage imageNamed:@"defaultImage"]];
   
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
